<?php
/**
 * Created by PhpStorm.
 * User: ysfl
 * Date: 16-3-5
 * Time: 下午1:27
 */

//名字空间
namespace app\gwbn\controllers;

use modules\gwbn\PanelModule;
use modules\gwbn\UserModule;

class   User extends Admin
{
    function Install()
    {
        $ADMIN = new UserModule();

        $this->data['InstallList'] = $ADMIN->Install_Query();

        //  调用页面
        $this->display($this->data);
    }

    function Install_Add()
    {
        $ADMIN = new UserModule();

        if ($this->is_post()){
            return $ADMIN->Install_Add($_POST);
        }
    }

    function NotInstall()
    {
        $ADMIN = new UserModule();

        $Not_Query = $ADMIN->Not_Install_Query();

        foreach($Not_Query as &$k){
            $k['List_Num'] = 0;
            if ($k['start'] == 0){
                $k['List_Num'] = $ADMIN->Not_Install_Query_List_Num($k['entry']);
            }
        }

        $this->data['NotInstallList'] = $Not_Query;

        //  调用页面
        $this->display($this->data);
    }

    function Not_Install_Add()
    {
        $ADMIN = new UserModule();

        if ($this->is_post()){
            return $ADMIN->Not_Install_Add($_POST);
        }
    }

    function Not_Install_Query_List()
    {
        $ADMIN = new UserModule();

        if ($this -> is_post()){

            $id = $_POST['value'];

            $List = $ADMIN->Not_Install_Query_List($id);

            if ($List){

                //返回JSON格式的列表数据
                return json_encode($List);
            }
            else{
                echo "0";
            }

        }
    }

    //确认&更新任务
    function Not_Install_Set()
    {
        //注册模块
        $ADMIN = new UserModule();

        return $ADMIN->Not_Install_Set($_POST);
    }
}